<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('capitalizes', function (Blueprint $table) {
            $table->id();
            $table->unsignedBigInteger('project_capitalize_id')->default(0);
            $table->string('name')->comment('借方名称');
            $table->decimal('amount', 15, 2)->default(0)->comment('金额');
            $table->decimal('interest_rate', 5, 2)->default(0)->comment('利息(%)');
            $table->unsignedTinyInteger('installments')->default(0)->comment('分期数');
            $table->decimal('monthly_payment', 15, 2)->default(0)->comment('月供（万元）');
            $table->decimal('principal', 15, 2)->default(0)->comment('本金（万元）');
            $table->decimal('total_interest', 15, 2)->default(0)->comment('总利息（万元）');
            $table->string('remarks')->default('/')->comment('备注');
            $table->string('files')->nullable()->default('')->comment('附件');
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('capitalizes');
    }
};
